Alexa (Echo) with ESP32 and ESP8266 – Voice Controlled Relay
In this project, you’re going to learn how to control the ESP8266 or the ESP32 with voice commands using Alexa (Amazon Echo Dot). As an example, we’ll control two 12V lamps connected to a relay module. We’ll also add two 433 MHz RF wall panel switches to physically control the lamps.Note : this tutorial is compatible with all Echo Dot generations and with the latest fauxmoESP library (3.1.0). It works with ESP32 and ESP8266.
Watch the Project Video Demonstration This project works both with ESP8266 and ESP32. We provide instructions for both development boards. Before getting straight to the project, read this section to see what you’ll achieve by the end of this project.
Project Overview Control Lamps using Alexa
By the end of this project you’ll be able to control two lamps (lamp 1 and lamp 2) with voices commands using Alexa. The figure below shows a high-level overview on how the project works to control lamp 1 – it works similarly for lamp 2.Alexa will respond to the following commands: “Alexa, turn on lamp 1” “Alexa, turn off lamp 1” “Alexa, turn on lamp 2” “Alexa, turn on lamp 2” “Alexa, turn on lamps” turns on both lamps “Alexa, turn off lamps” turns off both lamps When you say something like “Alexa, turn on lamp 1”, the ESP8266 or ESP32 will trigger a relay to turn on lamp 1. When you say something like“Alexa, turn off lamp 1”, the ESP8266 or ESP32 will send a signal to the relay to turn off the lamp. This works similarly for lamp 2.
Control Lamps using 433 MHz Wall Switches
In this project, we’ll also add two 433 MHz wall switches to physically control the lamps. You’ll have a switch for each lamp. The switch changes the lamp’s state to the opposite of its current state. For example, if the lamp is off, press the wall switch to turn it on. To turn it off, you just need to press the switch again. Take a look at the figure below that illustrates how it works.![]()
Here’s a complete list of the parts required for this project (click the links below to find the best price at Maker Advisor ):
Parts Required ESP Board (you can use either ESP32 or ESP8266): ESP8266 – read Best ESP8266 Wi-Fi Development Boards ESP32 – we use the ESP32 DOIT DEVKIT V1 Board– 36 GPIOs (read ESP32 development boards comparison ) Alexa – Echo, Echo Show or Echo Dot
(read the next section for more details) 433 MHz RF Wall Panel Switch 433 MHz transmitter/receiver 12V 2A power adaptor Step-down buck converter Relay module 12V lamp 12V lamp holder Male DC barrel jack 2.1mm Stripboard or breadboard Jumper WiresYou can use the links below to buy an Amazon Echo. There are several models available – all of them are compatible with this project.
How to Buy An Amazon Echo ![]()
The 433 MHz RF wall panel switch is a great way to remotely control devices. It can be easily attached to a wall with adhesive tap, without the need to make holes on the walls. Additionally, it is wireless, so you don’t need to worry about wiring and then hiding cables. In this project we’re using two wall panel switches. Instead, you can use a panel switch with two buttons – there are also another version with three switches.
433 MHz RF Wall Panel Switch This wall panel switchhas a push button in its circuit, as shown in the figure below, that when pressed emits a 433 MHz signal. You can use that signal to control whatever you want. This wall panel switch uses a 27A 12V type battery (not included in the package). So, you may want to buy one, when you get your wall panel switch.
![]()
When you press the 433 MHz wall panel switch, it sends a 433 MHz signal. You need to decode that signal using a 433 MHz receiver. To learn how to decode the 433 MHz signal read the following post: Decode and Send 433 MHz RF Signals with Arduino – read the “Decoder Sketch” part. The sketch works with Arduino, ESP32, and ESP8266. Take note of the decimal (24Bit) code for each of your switches, because you’ll need them later.
Decode the Wall Panel Switch 433 MHz RF Signals In my case: switch 1:
6819768 switch 2:9463928 You should get different values. You’ll then use these signals in your ESP8266 or ESP32 sketch. When you press the switch, it sends a 433 MHz signal. This signal is detected by the receiver that is connected to the ESP. This way, the ESP knows the switch was pressed and it inverts the lamp’s current state.![]()
To control your ESP8266 or ESP32 with Amazon Echo, you need to install the FauxmoESP library. This library emulates a Belkin Wemo device, allowing you to control your ESP32 or ESP8266 using this protocol.This way, the Echo or Echo Dot instantly recognizes the device, after uploading the code, without any extra skills or third party services. You can read more about FauxmoESP here .
The FauxmoESP Installing the FauxmoESP Library Click here to download the FauxmoESP library . You should have a .zip folder in your Downloads Unzip the.zipfolder and you should getxoseperez-fauxmoesp-50cbcf3087fd folder Rename your folder fromtoxoseperez-fauxmoesp-50cbcf3087fd xoseperez_fauxmoesp Move the xoseperez_fauxmoesp folder to your Arduino IDE installationlibraries folder Finally, re-open your Arduino IDEFollow these next instructions if you’re using an ESP8266.
Alexa – Echo Dot with ESP8266 Installing the ESP8266 Board in Arduino IDE In order to upload code to your ESP8266 using Arduino IDE, you should install an add-on for the Arduino IDE that allows you to program the ESP8266 using the Arduino IDE and its programming language. If you haven’t installed the ESP8266 add-on for the Arduino IDE, follow the next tutorial: How to Install the ESP8266 Board in Arduino IDE .Installing the ESPAsyncTCP Library You also need to install theESPAsyncTCP Library library. Follow the next instructions to install it: Click here to download the ESPAsyncTCP library . You should have a .zip folder in your Downloads Unzip the.zipfolder and you should getESPAsyncTCP-master folder Rename your folder fromE toSPAsyncTCP-master ESPAsyncTCP Move the ESPAsyncTCP folder to your Arduino IDE installationlibraries folder Finally, re-open your Arduino IDESchematic
If you’re using an ESP8266 board, assemble your circuit by following the next schematic diagram – you can click the image to zoom.If you’re having trouble following the circuit diagram, you can use the following table as a reference:
ESP8266 | Connect to |
GPIO 5 | 433 MHz receiver data pin |
GPIO 4 | Relay IN1 pin |
GPIO 14 | Relay IN2 pin |
ESP32 | Connect to |
GPIO 13 | 433 MHz receiver data pin |
GPIO 14 | Relay IN1 pin |
GPIO 12 | Relay IN2 pin |
BMP388 | GPIO 21 (SDA), GPIO 22 (SCL) |
OLED Display | GPIO 21 (SDA), GPIO 22 (SCL) |
MicroSD card Module | GPIO 5 (CS), GPIO 23 (MOSI), GPIO 18 (CLK), GPIO 19 (MISO) |
Pushbutton | GPIO 4 |
Pushbutton | GPIO 33 |
Trimpot | GPIO 32 |
Photoresistor (LDR) | GPIO 4 |
DHT22 data pin | GPIO 15 |
LED1 | GPIO 27 |
LED2 | GPIO 26 |
BMP180 | SDA(GPIO 21); SCL(GPIO 22) |
SD card module | MOSI(GPIO 23); MISO(GPIO 19): CLK(GPIO 18); CS(GPIO 5) |
Free GPIOs (terminal blocks) | GPIO14, GPIO13, GPIO12 |
btn1On | btn2On | btn3On | |
btn1Off | btn2Off | btn3Off | |
state1 | state2 | state3 |
esp_now_init() Initializes ESP-NOW. You must initialize Wi-Fi before initializing ESP-NOW. |
esp_now_add_peer() Call this function to pair a device and pass as an argument the peer MAC address. |
esp_now_send() Send data with ESP-NOW. |
esp_now_register_send_cb() Register a callback function that is triggered upon sending data. When a message is sent, a function is called – this function returns whether the delivery was successful or not. |
esp_now_register_rcv_cb() Register a callback function that is triggered upon receiving data. When data is received via ESP-NOW, a function is called. |
VIN | 3.3V |
GND | GND |
SCL | GPIO 22 |
SDA | GPIO 21 |
GND | GND |
VCC | VIN |
SCL | GPIO 22 |
SDA | GPIO 21 |
4 lux precision | 16 ms measurement time | |
1 lux precision | 120 ms measurement time | |
0.5 lux precision | 120 ms measurement time |
Powers the sensor (3.3V or 5V) | |
Common GND | |
SCL pin for I2C communication | |
| SDA pin for I2C communication |
| Selects address |
SCL | GPIO 22 |
SDA | GPIO 21 |
3.3V | |
GND | |
GPIO 22 | |
| GPIO 21 |
| Don’t connect |
Higher power consumption | Low power consumption | |
Higher data transfer rates | Lower data transfer rates | |
Longer range | Shorter range | |
Audio streaming, file transfer | IoT devices, wearables, smart home | |
Serial Port Profile (SPP) | Generic Attribute Profile (GATT) |
Vin | 3.3V |
GND | GND |
SCL | GPIO 22 |
SDA | GPIO 21 |
SCK (SCL Pin) | GPIO 22 |
SDI (SDA pin) | GPIO 21 |
SCK (SPI Clock) | GPIO 18 |
SDO(MISO) | GPIO 19 |
SDI (MOSI) | GPIO 23 |
CS (Chip Select) | GPIO 5 |
HSPI | GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 |
VSPI | GPIO 23 | GPIO 19 | GPIO 18 | GPIO 5 |
Temperature | +/- 1.0oC |
Humidity | +/- 3% |
Pressure | +/- 1 hPa |
| |
Temperature | -40 to 85 oC |
Humidity | 0 to 100 % |
Pressure | 300 to 1100 hPa |
Powers the sensor | |
Common GND | |
SCL pin for I2C communication SCK pin for SPI communication | |
SDA pin for I2C communication SDI (MOSI) pin for SPI communication | |
SDO (MISO) pin for SPI communication | |
Chip select pin for SPI communication |
SCL | GPIO22 |
SDA | GPIO 21 |
SCL (SCK SPI Clock) | GPIO 18 |
SDA (SDI MOSI) | GPIO 23 |
SDO (MISO) | GPIO 19 |
CS (Chip Select) | GPIO 5 |
300 to 1250 hPa (pressure) -40 to +85oC (temperature) | |
I2C and SPI | |
3.4 μA @ 1Hz | |
P=900 …1100 hPa (T=25 … 40°C) | ±0.5 hPa |
P=900…1100 hPa (T=25 … 40°C) | ±0.08 hPa |
| 0.03 Pa |
200 Hz |
VIN | Powers the sensor (5V) |
3V3 | Powers the sensor (3V3) |
GND | Common GND |
SCK | SCL pin for I2C communication SCK pin for SPI communication |
SDO | SDO (MISO) pin for SPI communication |
SDI | SDI (MOSI) pin for SPI communication SDA pin for I2C communication |
CS | Chip select pin for SPI communication |
INT | Interrupt pin |
| GPIO 21 |
| GPIO 22 |
GPIO 18 | |
| GPIO 23 |
| GPIO 19 |
| GPIO 5 |
GPIO 5 | |
GPIO 4 |
CLK | GPIO 14 |
CMD | GPIO 15 |
DATA0 | GPIO 2 |
DATA1 / flashlight | GPIO 4 |
DATA2 | GPIO 12 |
DATA3 | GPIO 13 |
D0 | GPIO 5 | Y2_GPIO_NUM |
D1 | GPIO 18 | Y3_GPIO_NUM |
D2 | GPIO 19 | Y4_GPIO_NUM |
D3 | GPIO 21 | Y5_GPIO_NUM |
D4 | GPIO 36 | Y6_GPIO_NUM |
D5 | GPIO 39 | Y7_GPIO_NUM |
D6 | GPIO 34 | Y8_GPIO_NUM |
D7 | GPIO 35 | Y9_GPIO_NUM |
XCLK | GPIO 0 | XCLK_GPIO_NUM |
PCLK | GPIO 22 | PCLK_GPIO_NUM |
VSYNC | GPIO 25 | VSYNC_GPIO_NUM |
HREF | GPIO 23 | HREF_GPIO_NUM |
SDA | GPIO 26 | SIOD_GPIO_NUM |
SCL | GPIO 27 | SIOC_GPIO_NUM |
POWER PIN | GPIO 32 | PWDN_GPIO_NUM |
IN1 | GPIO 14 |
IN2 | GPIO 15 |
IN3 | GPIO 13 |
IN4 | GPIO 12 |
set_brightness() | Set brightness | -2 to 2 |
set_contrast() | Set contrast | -2 to 2 |
set_saturation() | Set saturation | -2 to 2 |
set_special_effect() | Set a special effect | 0 – No Effect 1 – Negative 2 – Grayscale 3 – Red Tint 4 – Green Tint 5 – Blue Tint 6 – Sepia |
set_whitebal() | Set white balance | 0 – disable 1 – enable |
set_awb_gain() | Set white balance gain | 0 – disable 1 – enable |
set_wb_mode() | Set white balance mode | 0 – Auto 1 – Sunny 2 – Cloudy 3 – Office 4 – Home |
set_exposure_ctrl() | Set exposure control | 0 – disable 1 – enable |
set_aec2() | 0 – disable 1 – enable | |
set_ae_level() | -2 to 2 | |
set_aec_value() | 0 to 1200 | |
set_gain_ctrl() | 0 – disable 1 – enable | |
set_agc_gain() | 0 to 30 | |
set_gainceiling() | 0 to 6 | |
set_bpc() | 0 – disable 1 – enable | |
set_wpc() | 0 – disable 1 – enable | |
set_raw_gma() | 0 – disable 1 – enable | |
set_lenc() | Set lens correction | 0 – disable 1 – enable |
set_hmirror() | Horizontal mirror | 0 – disable 1 – enable |
set_vflip() | Vertical flip | 0 – disable 1 – enable |
set_dcw() | 0 – disable 1 – enable | |
set_colorbar() | Set a colorbar | 0 – disable 1 – enable |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
VIN/VCC | 3.3V |
GND | GND |
SCL | GPIO 22 |
SDA | GPIO 21 |
VIN/VCC | VIN |
GND | GND |
SCL | GPIO 22 |
SDA | GPIO 21 |
3V3 | 3V3 |
CS | GPIO 5 |
MOSI | GPIO 23 |
CLK | GPIO 18 |
MISO | GPIO 19 |
GND | GND |
%A | Full weekday name |
%B | Full month name |
%d | Day of the month |
%Y | Year |
%H | Hour in 24h format |
%I | Hour in 12h format |
%M | Minute |
%S | Second |
SIGNAL ON THE ENABLE PIN | MOTOR STATE |
---|---|
HIGH | Motor enabled |
LOW | Motor not enabled |
PWM | Motor enabled: speed proportional to the duty cycle |
0 | 1 | 1 | |
1 | 0 | 1 | |
0 | 0 | 0 |
DIRECTION | INPUT 1 | INPUT 2 | INPUT 3 | INPUT 4 |
---|---|---|---|---|
Forward | 0 | 1 | 0 | 1 |
Backward | 1 | 0 | 1 | 0 |
Right | 0 | 1 | 0 | 0 |
Left | 0 | 0 | 0 | 1 |
Stop | 0 | 0 | 0 | 0 |
GPIO 27 | GPIO 26 | GPIO 14 | GND |
Deta Base is a fully-managed, fast, scalable and secure NoSQL database with a focus on end-user simplicity. It offers a UI through which you can easily see, query, update and delete records in the database. https://docs.deta.sh/docs/base/aboutAnd the best part is that Deta Base is
Your data is encrypted and stored safely on AWS. Encryption keys are managed by AWS; AWS manages Exabytes of the world’s most sensitive data. https://docs.deta.sh/docs/base/about#is-my-data-secureWe recommend taking a look at the docs to get more familiar with Deta Base: Deta Base documentation Deta Base is still in the beta version, so you may expect improvements in the future.
A0 (ADC 0) | GPIOs: 0, 2, 4, 12, 13, 14, 15, 25, 26, 27, 32, 33, 34, 35, 36, and 39. | |
10-bit (0-1023) | 12-bit (0-4095) | |
No | Yes |
GND | GND |
VCC | VIN |
SDA | GPIO 21 |
SCL | GPIO 22 |
GND | GND |
VCC | VIN |
SDA | GPIO 4 (D2) |
SCL | GPIO 5 (D1) |
SCK (SCL Pin) | GPIO 22 |
SDI (SDA pin) | GPIO 21 |
SCK (SCL Pin) | GPIO 5 |
SDI (SDA pin) | GPIO 4 |
SCK (SCL Pin) | GPIO 22 |
SDI (SDA pin) | GPIO 21 |
SCK (SCL Pin) | GPIO 5 |
SDI (SDA pin) | GPIO 4 |
“For a more in-depth introduction to InfluxDB, check the following tutorials before proceeding: ESP32: Getting Started with InfluxDB ESP8266: Getting Started with InfluxDBWhy use InfluxDB Cloud? It’s a fast, elastic, serverless real-time monitoring platform, dashboarding engine, analytics service and event and metrics processor.” https://www.influxdata.com/products/influxdb-cloud/
5V DC | |
15 mA | |
40 kHz | |
4 meters | |
2 cm | |
15o | |
0.3 cm | |
10uS TTL pulse | |
TTL pulse proportional to the distance range | |
45mm x 20mm x 15mm |
VCC | Powers the sensor (5V) |
Trig | Trigger Input Pin |
Echo | Echo Output Pin |
GND | Common GND |
VCC | VIN |
Trig | GPIO 5 |
Echo | GPIO 18 |
GND | GND |
SDA (default is GPIO 21) | |
SCL (default is GPIO 22) | |
GND | |
usually 3.3V or 5V |
“Why use InfluxDB Cloud? It’s a fast, elastic, serverless real-time monitoring platform, dashboarding engine, analytics service and event and metrics processor.” https://www.influxdata.com/products/influxdb-cloud/
BME280 | GPIO 21 (SDA), GPIO 22 (SCL) |
PIR Motion Sensor | GPIO 27 |
Light Dependent Resistor (LDR) | GPIO 33 |
Pushbutton | GPIO 18 |
LED | GPIO 19 |
Additional Output | GPIO 32 |
MISO | |
CS | |
CLK | |
VCC (3.3V or 5V) | |
GND |
GND | GND |
VCC | 3.3V |
SCK | GPIO 5 |
CS | GPIO 23 |
SO | GPIO 19 |
Red (E+) | GND | ||
Black (E-) | GPIO 16 | ||
White (A-) | GPIO 4 | ||
Green (A+) | 3.3V |
VCC | 3.3V or 5V* |
GND | GND |
SDA | GPIO 21 |
SCL | GPIO 22 |
VIN | 3.3 V |
GND | GND |
SCL | GPIO 13 |
SDA | GPIO 21 |
3V3 | 3.3V |
CS | GPIO 5 |
MOSI | GPIO 23 |
CLK | GPIO 18 |
MISO | GPIO 19 |
GND | GND |
GPIO 23 | GPIO 19 | GPIO 18 | GPIO 5 | |
GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 |
VIN | 3V3 |
GND | GND |
SCL | GPIO 22 |
SDA | GPIO 21 |
3V3 | 3.3V |
CS | GPIO 5 |
MOSI | GPIO 23 |
CLK | GPIO 18 |
MISO | GPIO 19 |
GND | GND |
VCC | Power the sensor (3.3V or 5V) |
GND | Common GND |
SCL | SCL pin for I2C communication (GPIO 22) |
SDA | SDA pin for I2C communication (GPIO 21) |
XDA | Used to interface other I2C sensors with the MPU-6050 |
XCL | Used to interface other I2C sensors with the MPU-6050 |
AD0 | Use this pin to change the I2C address |
INT | Interrupt pin – can be used to indicate that new measurement data is available |
pulled up | OK | outputs PWM signal at boot, must be LOW to enter flashing mode | |
TX pin | OK | debug output at boot | |
OK | OK | connected to on-board LED, must be left floating or LOW to enter flashing mode | |
OK | RX pin | HIGH at boot | |
OK | OK | ||
OK | OK | outputs PWM signal at boot, strapping pin | |
x | x | connected to the integrated SPI flash | |
x | x | connected to the integrated SPI flash | |
x | x | connected to the integrated SPI flash | |
x | x | connected to the integrated SPI flash | |
x | x | connected to the integrated SPI flash | |
x | x | connected to the integrated SPI flash | |
OK | OK | boot fails if pulled high, strapping pin | |
OK | OK | ||
OK | OK | outputs PWM signal at boot | |
OK | OK | outputs PWM signal at boot, strapping pin | |
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | OK | ||
OK | input only | ||
OK | input only | ||
OK | input only | ||
OK | input only |
GPIO 23 | GPIO 19 | GPIO 18 | GPIO 5 | |
GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 |
3.3V power output (not to power the sensor) | |
ground pin | |
output pin (goes HIGH when motion is detected) | |
input voltage to power the sensor (4V to 28V) | |
light-dependent resistor output |
RCWL-0516 Microwave Radar | PIR Motion Sensor | |
Active Sensor (emits microwave signals and detects reflections). | Passive Sensor (detects infrared radiation emitted by objects). | |
Longer range, typically up to 7+ meters. | Shorter range, typically a few meters, depending on the model. | |
Can sense through non-metallic materials. | Obstructed by certain materials (e.g., glass) | |
Highly sensitive, may give false positives. | Not so sensitive, may miss subtle movements. Only detects living things that emit heat. | |
Broad coverage with wide radar pattern. | Narrow field of view. |
3V3 | don’t connect |
GND | GND |
OUT | GPIO15 (or any other GPIO of your choice) |
VIN | VIN (or a voltage between 4 and 28V) |
CDS | don’t connect |
putChar(const char* key, int8_t value) | |
putUChar(const char* key, int8_t value) | |
putShort(const char* key, int16_t value) | |
putUShort(const char* key, uint16_t value) | |
putInt(const char* key, int32_t value) | |
putUInt(const char* key, uint32_t value) | |
putLong(const char* key, int32_t value) | |
putULong(const char* key, uint32_t value) | |
putLong64(const char* key, int64_t value) | |
putULong64(const char* key, uint64_t value) | |
putFloat(const char* key, const float_t value) | |
putDouble(const char* key, const double_t value) | |
putBool(const char* key, const bool value) | |
putString(const char* key, const String value) | |
putBytes(const char* key, const void* value, size_t len) |
getChar(const char* key, const int8_t defaultValue) | |
getUChar(const char* key, const uint8_t defaultValue) | |
getShort(const char* key, const int16_t defaultValue | |
getUShort(const char* key, const uint16_t defaultValue) | |
getInt(const char* key, const int32_t defaultValue) | |
getUInt(const char* key, const uint32_t defaultValue) | |
getLong(const char* key, const int32_t defaultValue) | |
getULong(const char* key, const uint32_t defaultValue) | |
getLong64(const char* key, const int64_t defaultValue) | |
gettULong64(const char* key, const uint64_t defaultValue) | |
getFloat(const char* key, const float_t defaultValue) | |
getDouble(const char* key, const double_t defaultValue) | |
getBool(const char* key, const bool defaultValue) | |
getString(const char* key, const String defaultValue) | |
getString(const char* key, char* value, const size_t maxLen) | |
getBytes(const char* key, void * buf, size_t maxLen) |
Power | Red |
GND | Black, or brown |
Signal | Yellow, orange, or white |
GPIO 23 | GPIO 19 | GPIO 18 | GPIO 5 | |
GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 |
BME280 | GPIO 21 (SDA), GPIO 22 (SCL) |
Pushbutton | GPIO 18 |
Addressable RGB LEDs (row 1) | GPIO 27 |
Addressable RGB LEDs (row 2) | GPIO 32 |
IN1 | Control the motor: connect to a microcontroller digital pin |
IN2 | Control the motor: connect to a microcontroller digital pin |
IN3 | Control the motor: connect to a microcontroller digital pin |
IN4 | Control the motor: connect to a microcontroller digital pin |
VCC | Powers the motor |
GND | Common GND |
Motor connector | Connect the motor connector |
IN1 | GPIO 19 |
IN2 | GPIO 18 |
IN3 | GPIO 5 |
IN4 | GPIO 17 |
GND | GND |
VCC | 3.3V |
Data | GPIO 27 (or any other ESP32 ADC pin ) |
WiFi.mode(WIFI_STA) | station mode: the ESP32 connects to an access point |
WiFi.mode(WIFI_AP) | access point mode: stations can connect to the ESP32 |
WiFi.mode(WIFI_AP_STA) | access point and a station connected to another access point |
0 | WL_IDLE_STATUS | temporary status assigned whenWiFi.begin()is called |
1 | WL_NO_SSID_AVAIL | when no SSID are available |
2 | WL_SCAN_COMPLETED | scan networks is completed |
3 | WL_CONNECTED | when connected to a WiFi network |
4 | WL_CONNECT_FAILED | when the connection fails for all the attempts |
5 | WL_CONNECTION_LOST | when the connection is lost |
6 | WL_DISCONNECTED | when disconnected from a network |
0 | ARDUINO_EVENT_WIFI_READY | ESP32 Wi-Fi ready |
1 | ARDUINO_EVENT_WIFI_SCAN_DONE | ESP32 finishes scanning AP |
2 | ARDUINO_EVENT_WIFI_STA_START | ESP32 station start |
3 | ARDUINO_EVENT_WIFI_STA_STOP | ESP32 station stop |
4 | ARDUINO_EVENT_WIFI_STA_CONNECTED | ESP32 station connected to AP |
5 | ARDUINO_EVENT_WIFI_STA_DISCONNECTED | ESP32 station disconnected from AP |
6 | ARDUINO_EVENT_WIFI_STA_AUTHMODE_CHANGE | the auth mode of AP connected by ESP32 station changed |
7 | ARDUINO_EVENT_WIFI_STA_GOT_IP | ESP32 station got IP from connected AP |
8 | ARDUINO_EVENT_WIFI_STA_LOST_IP | ESP32 station lost IP and the IP is reset to 0 |
9 | ARDUINO_EVENT_WPS_ER_SUCCESS | ESP32 station wps succeeds in enrollee mode |
10 | ARDUINO_EVENT_WPS_ER_FAILED | ESP32 station wps fails in enrollee mode |
11 | ARDUINO_EVENT_WPS_ER_TIMEOUT | ESP32 station wps timeout in enrollee mode |
12 | ARDUINO_EVENT_WPS_ER_PIN | ESP32 station wps pin code in enrollee mode |
13 | ARDUINO_EVENT_WIFI_AP_START | ESP32 soft-AP start |
14 | ARDUINO_EVENT_WIFI_AP_STOP | ESP32 soft-AP stop |
15 | ARDUINO_EVENT_WIFI_AP_STACONNECTED | a station connected to ESP32 soft-AP |
16 | ARDUINO_EVENT_WIFI_AP_STADISCONNECTED | a station disconnected from ESP32 soft-AP |
17 | ARDUINO_EVENT_WIFI_AP_STAIPASSIGNED | ESP32 soft-AP assign an IP to a connected station |
18 | ARDUINO_EVENT_WIFI_AP_PROBEREQRECVED | Receive probe request packet in soft-AP interface |
19 | ARDUINO_EVENT_WIFI_AP_GOT_IP6 | ESP32 access point v6IP addr is preferred |
19 | ARDUINO_EVENT_WIFI_STA_GOT_IP6 | ESP32 station v6IP addr is preferred |
19 | ARDUINO_EVENT_ETH_GOT_IP6 | Ethernet IPv6 is preferred |
20 | ARDUINO_EVENT_ETH_START | ESP32 ethernet start |
21 | ARDUINO_EVENT_ETH_STOP | ESP32 ethernet stop |
22 | ARDUINO_EVENT_ETH_CONNECTED | ESP32 ethernet phy link up |
23 | ARDUINO_EVENT_ETH_DISCONNECTED | ESP32 ethernet phy link down |
24 | ARDUINO_EVENT_ETH_GOT_IP | ESP32 ethernet got IP from connected AP |
25 | ARDUINO_EVENT_MAX |
BME280 | GPIO 21 (SDA), GPIO 22 (SCL) |
OLED Display | GPIO 21 (SDA), GPIO 22 (SCL) |
Light Dependent Resistor (LDR) | GPIO 33 |
Pushbutton | GPIO 18 |
Addressable RGB LEDs | GPIO 27 |
3V3 | 3.3V |
CS | GPIO 5 |
MOSI | GPIO 23 |
CLK | GPIO 18 |
MISO | GPIO 19 |
GND | GND |
HSPI | GPIO 13 | GPIO 12 | GPIO 14 | GPIO 15 |
VSPI | GPIO 23 | GPIO 19 | GPIO 18 | GPIO 5 |
Vin | 3.3V |
GND | GND |
SCL | GPIO 22 (SCL) |
SDA | GPIO 21 (SDA) |
2 (dual core) | |
2.4 GHz up to 150 Mbits/s | |
BLE (Bluetooth Low Energy) and legacy Bluetooth | |
32 bits | |
Up to 240 MHz | |
512 KB | |
30, 36, or 38 (depending on the model) | |
Capacitive touch, ADC (analog to digital converter), DAC (digital to analog converter), I2C (Inter-Integrated Circuit), UART (universal asynchronous receiver/transmitter), CAN 2.0 (Controller Area Netwokr), SPI (Serial Peripheral Interface), I2S (Integrated Inter-IC Sound), RMII (Reduced Media-Independent Interface), PWM (pulse width modulation), and more. | |
RESET and BOOT buttons | |
built-in blue LED connected to GPIO2; built-in red LED that shows the board is being powered | |
CP2102 |
TX | GPIO 26 |
RX | GPIO 27 |
POWER | GPIO 4 |
MOSI | GPIO 15 |
SCLK | GPIO 14 |
CS | GPIO 13 |
MISO | GPIO 2 |
GND | GND |
5V | VCC (5V) |
U0R | TX |
U0T | RX |
GPIO 0 | GND |
IN1 | GPIO 19 |
IN2 | GPIO 18 |
IN3 | GPIO 5 |
IN4 | GPIO 17 |
IN1 | GPIO 19 |
IN2 | GPIO 18 |
IN3 | GPIO 5 |
IN4 | GPIO 17 |
LOW | LOW | LOW | 0x70 |
HIGH | LOW | LOW | 0x71 |
LOW | HIGH | LOW | 0x72 |
HIGH | HIGH | LOW | 0x73 |
LOW | LOW | HIGH | 0x74 |
HIGH | LOW | HIGH | 0x75 |
LOW | HIGH | HIGH | 0x76 |
HIGH | HIGH | HIGH | 0x77 |
Powers the multiplexer | |
Connect to GND | |
Connect to the master microcontroller SDA pin | |
Connect to the master microcontroller SCL pin | |
Active low RST pin—can be used to reset the multiplexer | |
Selects multiplexer I2C address—connect to GND or VCC | |
Selects multiplexer I2C address—connect to GND or VCC | |
Selects multiplexer I2C address—connect to GND or VCC | |
SDA for channel 0 | |
SCL for channel 0 | |
SDA for channel 1 | |
SCL for channel 1 | |
SDA for channel 2 | |
SCL for channel 2 | |
SDA for channel 3 | |
SCL for channel 3 | |
SDA for channel 4 | |
SCL for channel 4 | |
SDA for channel 5 | |
SCL for channel 5 | |
SDA for channel 6 | |
SCL for channel 6 | |
SDA for channel 7 | |
SCL for channel 7 |
GPIO 22 (SCL), GPIO 21 (SDA) | |
GPIO 5 (D1) (SCL), GPIO 4 (D2) (SDA) | |
A5 (SCL), A4 (SDA) |
GPIO 22 (SCL), GPIO 21 (SDA) | |
GPIO 5 (D1) (SCL), GPIO 4 (D2) (SDA) | |
A5 (SCL), A4 (SDA) |
Free Projects | Course/eBook | |
ESP32 Tutorials | Learn ESP32 with Arduino IDE | |
ESP8266 Tutorials | Home Automation using ESP8266 | |
Arduino Tutorials | Arduino Step-by-step Projects |
| |
GPIO 4 | |
GPIO 15 | |
GPIO 16 |
MISO | GPIO 19 |
MOSI | GPIO 27 |
SCK | GPIO 5 |
CS | GPIO 18 |
IRQ | GPIO 26 |
RST | GPIO 14 |
D2 | GPIO 17 |
D3 | GPIO 35 |
D4 | GPIO 34 |
D5 | GPIO 5 |
D6 | GPIO 39 |
D7 | GPIO 18 |
D8 | GPIO 36 |
D9 | GPIO 19 |
SIOC | GPIO 23 |
SIOD | GPIO 25 |
XCLK | GPIO 27 |
VSYNC | GPIO 22 |
HREF | GPIO 26 |
PCLK | GPIO 21 |
RST | GPIO 15 |
PWDN | GPIO 0 |
SDA | GPIO 14 |
SCL | GPIO 13 |